{template header.html}
<script type="text/javascript">
$(function() {
	SwapTab({$page});
	{if $result}
	art.dialog.tips('<font color=red>{$result}</font>', 3, 2);
	{/if}
	$("#dr_row_thumb").addClass("dr_one");
	// 会员组权限联动
	$(".dr_select_all input").click(function(data){
		var _class = $(this).attr("class");
		if ($(this).attr('checked')) {
			$("."+_class).attr("checked",true);
		} else {
			$("."+_class).attr("checked",false);
		}
	});
	// 管理组权限联动
	$(".dr_admin .dr_show").click(function(data){
		if (!$(this).attr('checked')) {
			//设置增删改不可用
			$(this).next(".dr_add").attr("disabled", true);
			$(this).next(".dr_add").next(".dr_edit").attr("disabled", true);
			$(this).next(".dr_add").next(".dr_edit").next(".dr_del").attr("disabled", true);
		} else {
			//设置增删改可用
			$(this).next(".dr_add").attr("disabled", false);
			$(this).next(".dr_add").next(".dr_edit").attr("disabled", false);
			$(this).next(".dr_add").next(".dr_edit").next(".dr_del").attr("disabled", false);
		}
	});
	$(".dr_admin .dr_show").each(function(data){
		if (!$(this).attr('checked')) {
			//设置增删改不可用
			$(this).next(".dr_add").attr("disabled", true);
			$(this).next(".dr_add").next(".dr_edit").attr("disabled", true);
			$(this).next(".dr_add").next(".dr_edit").next(".dr_del").attr("disabled", true);
		} else {
			//设置增删改可用
			$(this).next(".dr_add").attr("disabled", false);
			$(this).next(".dr_add").next(".dr_edit").attr("disabled", false);
			$(this).next(".dr_add").next(".dr_edit").next(".dr_del").attr("disabled", false);
		}
	});
});
function dr_form_check() {
	var radio = $('input[name="_all"]').filter(':checked');
	if (radio.length && radio.val() == 1) {
		if (d_required('names')) return false;
	} else {
		if (d_required('name')) return false;
		if (d_required('dirname')) return false;
	}
	return true;
}
function dr_load_url() {
	var catid = $("#dr_load_catid").val();
	if (catid==0) {
		art.dialog.tips("<font color=red>{lang('html-604')}</font>", 3);
		return;
	}
	$.post("{dr_url(APP_DIR.'/category/urlrule')}&catid="+catid, function(data) {
		if (data) {
			$("#url_show").val(data.show);
			$("#url_show_page").val(data.show_page);
			$("#url_list").val(data.list);
			$("#url_list_page").val(data.list_page);
			$("#url_catjoin").val(data.catjoin);
			{if $extend}
			$("#url_extend").val(data.extend);
			{/if}
			art.dialog.tips("{lang('000')}", 3, 1);
		} else {
			art.dialog.tips("<font color=red>{lang('html-605')}</font>", 3);
		}
	}, 'json');
}
function dr_select_all() {
    $("#dr_synid").find("option").attr("selected", "selected");
}
</script>
<form action="" method="post" name="myform" id="myform" onsubmit="return dr_form_check()">
<input name="page" id="page" type="hidden" value="{$page}" />
<input name="backurl" type="hidden" value="{$backurl}" />
<div class="subnav">
	<div class="content-menu ib-a blue line-x">
		{$menu}
	</div>
	<div class="bk10"></div>
	<div class="table-list col-tab">
		<ul class="tabBut cu-li">
			<li onclick="SwapTab(0)">{lang('html-083')}</li>
            <li onclick="SwapTab(1)">{lang('357')}</li>
			<li onclick="SwapTab(2)">{lang('html-084')}</li>
			<li onclick="SwapTab(3)">{lang('html-215')}</li>
			<li onclick="SwapTab(4)">{lang('html-217')}</li>
			{if $data.id}
			<li onclick="SwapTab(5)">{lang('html-218')}</li>
			<li onclick="SwapTab(6)">{lang('html-219')}</li>
			{/if}
		</ul>
		<div class="contentList pad-10 dr_table">
			<div id="cnt_0" style="display:none" class="dr_hide">
				<table width="100%" class="table_form">
				<tr>
					<th width="200"><font color="red">*</font>&nbsp;{lang('cat-10')}： </th>
					<td>{$select}</td>
				</tr>
				{if !$data.id}
				<tr>
					<th>{lang('cat-11')}： </th>
					<td>
					<input type="radio" name="_all" value="0" onclick="$('.dr_more').hide();$('.dr_one').show();" checked />&nbsp;<label>{lang('no')}</label>
                    &nbsp;&nbsp;&nbsp;
					<input type="radio" name="_all" value="1" onclick="$('.dr_more').show();$('.dr_one').hide();" />&nbsp;<label>{lang('yes')}</label>
					</td>
				</tr>
				<tr class="dr_more" style="display:none">
					<th><font color="red">*</font>&nbsp;{lang('cat-12')}： </th>
					<td><textarea style="width:200px;height:150px" name="names" id="dr_names" /></textarea>
					<br><font id="dr_names_tips" color="#999999">{lang('cat-13')}</font>
					</td>
				</tr>
				{/if}
				<tr class="dr_one">
					<th><font color="red">*</font>&nbsp;{lang('cat-14')}： </th>
					<td><input class="input-text" type="text" name="data[name]" value="{$data.name}" id="dr_name" onblur="d_topinyin('dirname','name', 1);" size="20" />
					<div class="onShow" id="dr_name_tips">{lang('cat-15')}</div>
					</td>
				</tr>
				<tr class="dr_one">
					<th><font color="red">*</font>&nbsp;{lang('cat-08')}： </th>
					<td>
					<input class="input-text" type="text" name="data[dirname]" id="dr_dirname" value="{$data.dirname}" size="20" />
					<div class="onShow" id="dr_dirname_tips">{lang('cat-16')}</div>
					</td>
				</tr>
				<tr class="dr_one">
					<th>{lang('cat-07')}： </th>
					<td>
					<input class="input-text" type="text" name="data[letter]" id="dr_letter" value="{$data.letter}" size="20" />
					<div class="onShow">{lang('cat-17')}</div>
					</td>
				</tr>
                    <tr>
                        <th>{lang('html-357')}： </th>
                        <td>
                            <input type="radio" name="data[show]" value="1" {dr_set_radio('show', $data['show'], '1', TRUE)} />&nbsp;<label>{lang('yes')}</label>&nbsp;&nbsp;&nbsp;&nbsp;
                            <input type="radio" name="data[show]" value="0" {dr_set_radio('show', $data['show'], '0')} />&nbsp;<label>{lang('no')}</label>
                            <div class="onShow">{lang('html-358')}</div>
                        </td>
                    </tr>
                    <tr>
                        <th>{lang('html-635')}： </th>
                        <td>
                            <input type="radio" name="data[setting][edit]" value="0" {if !$data['setting']['edit']}checked{/if} />&nbsp;<label>{lang('yes')}</label>&nbsp;&nbsp;&nbsp;&nbsp;
                            <input type="radio" name="data[setting][edit]" value="1" {if $data['setting']['edit']}checked{/if} />&nbsp;<label>{lang('no')}</label>
                            <div class="onShow">{lang('html-636')}</div>
                        </td>
                    </tr>
				</table>
			</div>
			<div id="cnt_1" style="display:none" class="dr_hide">
				<table width="100%" class="table_form">
                    <tr>
                        <th width="200">{lang('148')}： </th>
                        <td>
                            <input class="input-text" type="text" name="data[setting][linkurl]" value="{$data['setting']['linkurl']}" size="60" />
                            <div class="onShow">{lang('html-736')}</div>
                        </td>
                    </tr>
                    <tr>
                        <th>{lang('149')}： </th>
                        <td>
                            <select name="data[setting][urlrule]">
                                <option value="0"> -- </option>
                                {list action=cache name=urlrule return=u}
                                {if $u.type==1}<option value="{$u.id}" {if $u.id==$data['setting']['urlrule']}selected{/if}> {$u.name} </option>{/if}
                                {/list}
                            </select>
                            <div class="onShow">{lang('html-694')}</div>
                        </td>
                    </tr>
                    {$thumb}
                    {$field}
				</table>
			</div>
			<div id="cnt_2" style="display:none" class="dr_hide">
				<table width="100%" class="table_form">
                <tr>
					<th width="200">{lang('html-231')}： </th>
					<td><input class="input-text" type="text" name="data[setting][seo][show_title]" value="{$data['setting']['seo']['show_title']}" size="80" />
					<div class="onShow">&nbsp;<a href="javascript:dr_seo_rule();">{lang('html-173')}</a></div>
					</td>
				</tr>
                {if $extend}
				<tr>
					<th>{lang('html-596')}： </th>
					<td><input class="input-text" type="text" name="data[setting][seo][extend_title]" value="{$data['setting']['seo']['extend_title']}" size="80" />
					<div class="onShow">&nbsp;<a href="javascript:dr_seo_rule();">{lang('html-173')}</a></div>
					</td>
				</tr>
                {/if}
				<tr>
					<th>{lang('html-232')}： </th>
					<td><input class="input-text" type="text" name="data[setting][seo][list_title]" value="{$data['setting']['seo']['list_title']}" size="80" />
					<div class="onShow">&nbsp;<a href="javascript:dr_seo_rule();">{lang('html-173')}</a></div>
					</td>
				</tr>
				<tr>
					<th>{lang('html-233')}： </th>
					<td><input class="input-text" type="text" name="data[setting][seo][list_keywords]" value="{$data['setting']['seo']['list_keywords']}" size="80" />
					<div class="onShow">&nbsp;<a href="javascript:dr_seo_rule();">{lang('html-173')}</a></div>
					</td>
				</tr>
				<tr class="dr_border_none">
					<th>{lang('html-234')}： </th>
					<td><input class="input-text" type="text" name="data[setting][seo][list_description]" value="{$data['setting']['seo']['list_description']}" size="80" />
					<div class="onShow">&nbsp;<a href="javascript:dr_seo_rule();">{lang('html-173')}</a></div>
					</td>
				</tr>
				</table>
			</div>
            <div id="cnt_3" style="display:none" class="dr_hide">
				<table width="100%" class="table_form">
				<tr>
                    <th width="200">{lang('html-235')}：</th>
                    <td>
                    <input type="text" class="input-text" size="10" value="{$data['setting']['template']['pagesize']}" name="data[setting][template][pagesize]" />
                    <div class="onShow">{lang('html-242')}</div>
                    </td>
                </tr>
                <tr>
                    <th>{lang('html-240')}：</th>
                    <td>
                    <input type="text" class="input-text" size="30" value="{$data['setting']['template']['show']}" name="data[setting][template][show]" />
                    <div class="onShow">{lang('html-241')}</div>
                    </td>
                </tr>
                {if $extend}
                <tr>
                    <th>{lang('html-593')}：</th>
                    <td>
                    <input type="text" class="input-text" size="30" value="{php echo $data['setting']['template']['extend'] ? $data['setting']['template']['extend'] : 'extend.html'}" name="data[setting][template][extend]" />
                    <div class="onShow">{lang('html-594')}</div>
                    </td>
                </tr>
                {/if}
                <tr>
                    <th>{lang('html-236')}：</th>
                    <td>
                    <input type="text" class="input-text" size="30" value="{$data['setting']['template']['category']}" name="data[setting][template][category]" />
                    <div class="onShow"><a href="{MODULE_URL}index.php?c=category&catid={$id}" target="_blank">{lang('html-237')}</a></div>
                    </td>
                </tr>
                <tr class="">
                    <th>{lang('html-238')}：</th>
                    <td>
                    <input type="text" class="input-text" size="30" value="{$data['setting']['template']['list']}" name="data[setting][template][list]" />
                    <div class="onShow"><a href="{MODULE_URL}index.php?c=category&catid={$id}" target="_blank">{lang('html-239')}</a></div>
                    </td>
                </tr>
                <tr class="dr_border_none">
                    <th>{lang('html-347')}：</th>
                    <td>
                    <input type="text" class="input-text" size="30" value="{php echo $data['setting']['template']['search'] ? $data['setting']['template']['search'] : 'search.html'}" name="data[setting][template][search]" />
                    <div class="onShow"><a href="{MODULE_URL}index.php?c=search&catid={$id}" target="_blank">{lang('html-227')}</a></div>
                    </td>
                </tr>
				</table>
			</div>
            <div id="cnt_4" style="display:none" class="dr_hide">
				<table width="100%" class="table_form dr_admin">
				{if !$data.child || MODULE_PCATE_POST}
                {dr_admin_rule($role, $data['setting']['admin'])}
                <tr>
                    <th width="200"> </th>
                    <td><font color="red">{lang('html-253')}</font></td>
                </tr>
				{else}
				<tr>
                    <th width="200"> </th>
                    <td><font color="red"><b>{lang('html-317')}</b></font></td>
                </tr>
				{/if}
				</table>
			</div>
			{if $data.id}
            <div id="cnt_5" style="display:none" class="dr_hide">
				<table width="100%" class="table_form">
				{if !$data.child || MODULE_PCATE_POST}
                <tr>
					<td align="left" width="100">&nbsp;</td>
					<td align="left" width="250">{lang('html-316')}&nbsp;</td>
					<td align="left" class="dr_select_all">
					<label>{lang('deny')}</label>&nbsp;<input class="dr_show" name="show" type="checkbox" />&nbsp;&nbsp&nbsp;
					<label>{lang('add')}</label>&nbsp;<input class="dr_add" name="add" type="checkbox" />&nbsp;&nbsp&nbsp;
					<label>{lang('edit')}</label>&nbsp;<input class="dr_edit" name="edit" type="checkbox" />&nbsp;&nbsp&nbsp;
					<label>{lang('del')}</label>&nbsp;<input class="dr_del" name="del" type="checkbox" />&nbsp;&nbsp&nbsp;
					</td>
				</tr>
				<tr>
					<td align="left">&nbsp;</td>
					<td align="left">{lang('guest')}&nbsp;</td>
					<td align="left">
					<label>{lang('deny')}</label>&nbsp;<input class="dr_show" name="rule[0][show]" {if $data['permission'][0]['show']}checked{/if} value=1 type="checkbox" />&nbsp;&nbsp&nbsp;
					<label>{lang('add')}</label>&nbsp;<input class="dr_add" name="rule[0][add]" {if $data['permission'][0]['add']}checked{/if} value=1 type="checkbox" />&nbsp;&nbsp&nbsp;
					</td>
				</tr>
				{list action=cache name=MEMBER.group return=group}
				{if $group.id > 2}
				<tr>
					<td align="left">&nbsp;</td>
					<td align="left">{$group.name}</td>
					<td align="left"></td>
				</tr>
				{loop $group.level $level}
				<tr>
					{php $id=$group['id'].'_'.$level['id'];}
					<td align="left">&nbsp;</td>
					<td align="left" style="padding-left:40px">{$level.name}&nbsp;&nbsp;{dr_show_stars($level.stars)}</td>
					<td align="left">
					<label>{lang('deny')}</label>&nbsp;<input class="dr_show" name="rule[{$id}][show]" {if $data['permission'][$id]['show']}checked{/if} value=1 type="checkbox" />&nbsp;&nbsp&nbsp;
					<label>{lang('add')}</label>&nbsp;<input class="dr_add" name="rule[{$id}][add]" {if $data['permission'][$id]['add']}checked{/if} value=1 type="checkbox" />&nbsp;&nbsp&nbsp;
					<label>{lang('edit')}</label>&nbsp;<input class="dr_edit" name="rule[{$id}][edit]" {if $data['permission'][$id]['edit']}checked{/if} value=1 type="checkbox" />&nbsp;&nbsp&nbsp;
					<label>{lang('del')}</label>&nbsp;<input class="dr_del" name="rule[{$id}][del]" {if $data['permission'][$id]['del']}checked{/if} value=1 type="checkbox" />&nbsp;&nbsp&nbsp;
					<a href="javascript:;" onclick="dr_member_rule('{$id}', '{dr_url(APP_DIR."/category/rule", array("catid"=>$data['id'], "id"=>$id))}', '{$group['name']}-{$level['name']}')" class="blue">[{lang('113')}]</a>
					<div id="dr_status_{$id}" class="onShow"></div>
					</td>
				</tr>
				{/loop}
				{else}
				<tr>
					{php $id=$group.id;}
					<td align="left">&nbsp;</td>
					<td align="left">{$group.name}</td>
					<td align="left">
					<label>{lang('deny')}</label>&nbsp;<input class="dr_show" name="rule[{$id}][show]" {if $data['permission'][$id]['show']}checked{/if} value=1 type="checkbox" />&nbsp;&nbsp&nbsp;
					<label>{lang('add')}</label>&nbsp;<input class="dr_add" name="rule[{$id}][add]" {if $data['permission'][$id]['add']}checked{/if} value=1 type="checkbox" />&nbsp;&nbsp&nbsp;
					<label>{lang('edit')}</label>&nbsp;<input class="dr_edit" name="rule[{$id}][edit]" {if $data['permission'][$id]['edit']}checked{/if} value=1 type="checkbox" />&nbsp;&nbsp&nbsp;
					<label>{lang('del')}</label>&nbsp;<input class="dr_del" name="rule[{$id}][del]" {if $data['permission'][$id]['del']}checked{/if} value=1 type="checkbox" />&nbsp;&nbsp&nbsp;
					<a href="javascript:;" onclick="dr_member_rule('{$id}', '{dr_url(APP_DIR."/category/rule", array("catid"=>$data['id'], "id"=>$id))}', '{$group['name']}')" class="blue">[{lang('113')}]</a>
					<div id="dr_status_{$id}" class="onShow"></div>
					</td>
				</tr>
				{/if}
				{/list}
				<tr>
                    <td> </td>
                    <td> </td>
                    <td><font color="gray">{lang('html-254')}</font></td>
                </tr>
				{else}
				<tr>
                    <th width="200"> </th>
                    <td> </td>
                    <td><font color="red"><b>{lang('html-317')}</b></font></td>
                </tr>
				{/if}
				</table>
			</div>
			<div id="cnt_6" style="display:none" class="dr_hide">
				<table width="100%" class="table_form">
                <tr>
                    <th>{lang('html-024')}：</th>
                    <td>
					{$select_syn}
                        <input value="{lang('html-605')}" type="button" onclick="dr_select_all()" name="button" class="button" />
					<br>
                    <font color="gray">{lang('cat-21')}</font></td>
                </tr>
                <tr>
                    <th width="200">{lang('html-023')}：</th>
                    <td>
					<label>{lang('html-084')}</label>&nbsp;<input name="syn[]" type="checkbox" value="1">&nbsp;&nbsp;
					<label>{lang('html-215')}</label>&nbsp;<input name="syn[]" type="checkbox" value="2" checked="">&nbsp;&nbsp;
					<label>{lang('html-217')}</label>&nbsp;<input name="syn[]" type="checkbox" value="3" checked="">&nbsp;&nbsp;
					<label>{lang('html-218')}</label>&nbsp;<input name="syn[]" type="checkbox" value="4" checked="">&nbsp;&nbsp;
					<label>{lang('149')}</label>&nbsp;<input name="syn[]" type="checkbox" value="5" checked="">&nbsp;&nbsp;
					</td>
                </tr>
				</table>
			</div>
			{/if}
			<table width="100%" class="table_form">
			<tr>
				<th width="200"> </th>
				<td><input value="{lang('submit')}" type="submit" name="submit" class="button" />
				</td>
			</tr>
			</table>
		</div>
	</div>
</div>
</form>
{template footer.html}